<template>
  <div>
    <div v-if="!hasData" class="tips">暂无证书</div>
    <div v-if="hasData" class="sw">
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="certificateNo"
        label="编号"
        width="100">
      </el-table-column>
      <el-table-column
        prop="certificateType"
        label="等级"
        width="100">
      </el-table-column>
      <el-table-column
        prop="certificateName"
        label="证书名"
        width="150">
      </el-table-column>
      <el-table-column
      prop="certificateContent"
      label="证书内容">
    </el-table-column>
    </el-table>
    </div>
  </div>
</template>

<script>
export default {
  name: 'pcCertificate',
  data () {
    return {
      tableData: '',
      hasData: false
    }
  },
  mounted: function () {
    this.http.get(this.ports.personalCenter.member.certificates,
      res => {
        if (res.status === 200) {
          let data = res.data.result
          if (data.code === 200) {
            this.tableData = data.msg
            this.hasData = true
          } else if (data.code === 1 || data.code === -1) {
            this.hasData = false
          }
        } else if (res.status === 401) {
          this.$router.push('/')
        } else {
          console.log(res)
        }
      })
  }
}
</script>

<style  lang="scss" scoped>
  .tips {
    margin-top: 100px;
    color: #5e5e5e;
  }
  .sw {
    margin-bottom: 100px;
  }
</style>
